package com.duolaibei.business.utils.cutdown;

import android.annotation.SuppressLint;
import android.widget.TextView;

/**
 * Created by xlm on 2017/7/17 0017
 */
public class CountDownTimerUtil extends CountDownTimer {

    private TextView mTextView;

    public CountDownTimerUtil(TextView mTextView, long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.mTextView = mTextView;
    }

    @Override
    public void onStart() {
        mTextView.setClickable(false);
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void onTick(long millisUntilFinished) {
        mTextView.setText(millisUntilFinished / 1000 + "s后重发");
    }

    @Override
    public void onFinish() {
        mTextView.setClickable(true);
        mTextView.setText("获取验证码");
    }
}
